<html>
<head><meta charset="utf-8"><title>RUSTFLAGS encoded environment variable · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html">RUSTFLAGS encoded environment variable</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246644093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246644093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246644093">(Jul 20 2021 at 20:20)</a>:</h4>
<p>Following up on the meeting just now, I thought about it further, and I realized that <em>we</em> currently translate rustflags into the encoded version when passing it down. <em>Are</em> these rustflags actually used for just the target, or are they also used for host invocations?</p>



<a name="246644142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246644142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246644142">(Jul 20 2021 at 20:21)</a>:</h4>
<p>Related: should it be <code>CARGO_TARGET_RUSTDOCFLAGS_ENCODED</code> or <code>CARGO_RUSTDOCFLAGS_ENCODED</code>?</p>



<a name="246644170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246644170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246644170">(Jul 20 2021 at 20:21)</a>:</h4>
<p>^ <span class="user-group-mention" data-user-group-id="3139">@T-cargo</span></p>



<a name="246644303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246644303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246644303">(Jul 20 2021 at 20:22)</a>:</h4>
<p>I have the change ready to go, assuming it should all use <code>CARGO_TARGET_{}_ENCODED</code>, but if <code>RUSTDOCFLAGS</code> should correspond to <code>CARGO_RUSTDOCFLAGS_ENCODED</code> without <code>TARGET_</code> then I need to tweak that.</p>



<a name="246645059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645059">(Jul 20 2021 at 20:28)</a>:</h4>
<p>I think the original suggestion was <code>CARGO_ENCODED_TARGET_RUSTFLAGS</code>.</p>
<p>Regarding "are these flags used for target or host", the answer is "yes" <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span> .  This encoded variable is equivalent to RUSTFLAGS.  If you don't specify <code>--target</code>, RUSTFLAGS applies to both, if you do specify <code>--target</code>, then it only applies to target. There is no option to specify host-only flags, yet (<a href="https://github.com/rust-lang/cargo/issues/4423">https://github.com/rust-lang/cargo/issues/4423</a>).  The idea is that once <a href="https://github.com/rust-lang/rust/issues/4423">#4423</a> is fixed, then there could be a <code>CARGO_ENCODED_HOST_RUSTFLAGS</code> to match.   I think Jon's concern was that the wording here could be confusing with the historical use of RUSTFLAGS, and since there isn't much progress on supporting host-specific RUSTFLAGS, it's not really clear exactly what that would look like.</p>



<a name="246645198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645198">(Jul 20 2021 at 20:29)</a>:</h4>
<p>OK, if this is currently used for both host and target, it shouldn't have <code>TARGET_</code> in it. :)</p>



<a name="246645241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645241">(Jul 20 2021 at 20:30)</a>:</h4>
<p>That's Jon's position I think.</p>



<a name="246645325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645325">(Jul 20 2021 at 20:30)</a>:</h4>
<p>I think that's my position as well; I had had the impression that this was only used for the target, which would motivate having <code>TARGET_</code> in the name.</p>



<a name="246645333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645333">(Jul 20 2021 at 20:30)</a>:</h4>
<p>My concern was in the future, we would end up with <code>CARGO_ENCODED_RUSTFLAGS</code> and <code>CARGO_ENCODED_HOST_RUSTFLAGS</code>, and it might not be clear just reading those two what the first one means.</p>



<a name="246645365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645365">(Jul 20 2021 at 20:30)</a>:</h4>
<p>I agree, but if that's a concern, we'd need to actually fix the usage and not just the name.</p>



<a name="246645380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645380">(Jul 20 2021 at 20:30)</a>:</h4>
<p>And I don't think that's worth blocking this issue over.</p>



<a name="246645395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645395">(Jul 20 2021 at 20:30)</a>:</h4>
<p>We already <em>have</em> that issue.</p>



<a name="246645458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645458">(Jul 20 2021 at 20:31)</a>:</h4>
<p>I think, if we want to fix this in the future, we might want to introduce <em>two</em> new variables (and possibly deprecate the undifferentiated one).</p>



<a name="246645478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645478">(Jul 20 2021 at 20:31)</a>:</h4>
<p>But in the meantime, I'm going to drop the use of TARGET.</p>



<a name="246645844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/RUSTFLAGS%20encoded%20environment%20variable/near/246645844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/RUSTFLAGS.20encoded.20environment.20variable.html#246645844">(Jul 20 2021 at 20:34)</a>:</h4>
<p>It's now in FCP.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>